home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume5 / htroff2 < prev    next >
Encoding:
Internet Message Format  |  1989-02-03  |  4.4 KB

  1. Path: xanth!nic.MR.NET!hal!ncoast!allbery
  2. From: edf@ROCKY2.ROCKEFELLER.EDU (David MacKenzie)
  3. Newsgroups: comp.sources.misc
  4. Subject: v05i010: troff2lj-v2 htroff that downloads fonts
  5. Message-ID: <8810250510.AA28540@rocky2>
  6. Date: 28 Oct 88 02:33:57 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Reply-To: edf@ROCKY2.ROCKEFELLER.EDU (David MacKenzie)
  9. Lines: 141
  10. Approved: allbery@ncoast.UUCP
  11.  
  12. Posting-number: Volume 5, Issue 10
  13. Submitted-by: "David MacKenzie" <edf@ROCKY2.ROCKEFELLER.EDU>
  14. Archive-name: htroff2
  15.  
  16. This can't hold a candle to JetRoff's automatic selective-downloading
  17. of fonts, but it's an improvement over the previous "htroff" script.
  18. It ensures that the downloaded fonts and the troff document are sent
  19. to the printer as the same print job (previously a problem on our system
  20. as other people were running programs that used the printer memory for
  21. graphics or just deleted all of the soft fonts for speed).
  22.  
  23. I wrap "htroff" in an additional layer.  I wrote one-lines scripts
  24. called "mstroff", "mantroff", "mmtroff" etc. that call htroff with the
  25. appropriate flags to use the appropriate macros and download the needed
  26. fonts, so I can just say "mmtroff foo.mm &" to format and print foo.mm
  27. on the LaserJet.
  28.  
  29. #! /bin/sh
  30. # This is a shell archive.  Remove anything before this line, then unpack
  31. # it by saving it into a file and typing "sh file".  To overwrite existing
  32. # files, type "sh file -c".  You can also feed this as standard input via
  33. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  34. # will see the following message at the end:
  35. #        "End of shell archive."
  36. # Contents:  htroff.1 htroff
  37. # Wrapped by dave@edfdc  on Tue Sep 20 02:18:58 1988
  38. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  39. if test -f 'htroff.1' -a "${1}" != "-c" ; then 
  40.   echo shar: Will not clobber existing file \"'htroff.1'\"
  41. else
  42. echo shar: Extracting \"'htroff.1'\" \(815 characters\)
  43. sed "s/^X//" >'htroff.1' <<'END_OF_FILE'
  44. X.TH HTROFF 1
  45. X.SH NAME
  46. Xhtroff \- text formatter for HP LaserJet
  47. X.SH SYNOPSIS
  48. X.B htroff
  49. X[
  50. X.B \-options
  51. X] [
  52. X.B files
  53. X]
  54. X.SH DESCRIPTION
  55. X.I Htroff
  56. Xis a front end for the troff(1) text formatting program.  It sends its 
  57. Xoutput to a Hewlett-Packard LaserJet or compatible printer.  In addition
  58. Xto all of the standard troff options, 
  59. X.I htroff
  60. Xalso accepts arguments of the form
  61. X.I \-nXX,
  62. Xwhich indicate that the font with name
  63. X.I XX
  64. Xis to be mounted on font position
  65. X.I n
  66. X(1 <=
  67. X.I n
  68. X<= 3).  Fonts 1-3 default to "R", "I", and "B", (Times Roman, Times
  69. XBold, and Times Italic) respectively.
  70. X.PP
  71. XAlso, arguments of the form
  72. X.I \-dfontfile
  73. Xare accepted, and cause the named
  74. X.I fontfile
  75. Xto be downloaded to the printer before the text is printed.
  76. X.SH "SEE ALSO"
  77. Xdownload(1), troff(1)
  78. X.SH AUTHORS
  79. XSverre Froyen, David MacKenzie
  80. END_OF_FILE
  81. if test 815 -ne `wc -c <'htroff.1'`; then
  82.     echo shar: \"'htroff.1'\" unpacked with wrong size!
  83. fi
  84. # end of 'htroff.1'
  85. fi
  86. if test -f 'htroff' -a "${1}" != "-c" ; then 
  87.   echo shar: Will not clobber existing file \"'htroff'\"
  88. else
  89. echo shar: Extracting \"'htroff'\" \(1117 characters\)
  90. sed "s/^X//" >'htroff' <<'END_OF_FILE'
  91. X:
  92. X# htroff - troff for HP LaserJet
  93. X# Usage: htroff [-options] [files]
  94. X#
  95. X# Special options:
  96. X# -nXX    mount font XX on position n (n = 1-3)
  97. X# -dYY    download font YY
  98. X#
  99. X# Sends its output to the LaserJet automatically.
  100. X# Latest revision: 07/26/88
  101. X
  102. Xtranslate=troff2lj
  103. X#translate=/usr/local/lib/troff2lj
  104. Xprintcmd='lpr -plaserjet'
  105. X#printcmd='uux -n - "sst!/usr/ucb/lpr -Prhp"'
  106. Xdownload= # null to start out with
  107. Xdfiles=
  108. X
  109. Xoptions=-t # Send output to stdout instead of /dev/cat.
  110. Xljopts=
  111. Xfiles=
  112. Xfont1=R
  113. Xfont2=I
  114. Xfont3=B
  115. X
  116. Xfor arg
  117. Xdo
  118. X    case $arg in
  119. X    -) files="$files $arg" ;;
  120. X    -d*) download="download -d";
  121. X         dfiles="$dfiles `echo $arg|sed 's/-d//'`" ;;
  122. X    -1*) font1=`echo $arg|sed 's/-1//'`; ljopts="$ljopts $arg" ;;
  123. X    -2*) font2=`echo $arg|sed 's/-2//'`; ljopts="$ljopts $arg" ;;
  124. X    -3*) font3=`echo $arg|sed 's/-3//'`; ljopts="$ljopts $arg" ;;
  125. X    -[4-9]*|-0*) echo "Illegal font mount: $arg" >&2; exit 1 ;;
  126. X    -*) options="$options $arg" ;;
  127. X    *) files="$files $arg" ;;
  128. X    esac
  129. Xdone
  130. X
  131. X{
  132. X$download $dfiles
  133. X{
  134. Xecho "\
  135. X.fp 1 $font1
  136. X.fp 2 $font2
  137. X.fp 3 $font3
  138. X.fp 4 S
  139. X.lg 0"
  140. X
  141. Xcat $files
  142. X} | troff $options | $translate $ljopts
  143. X} | $printcmd
  144. END_OF_FILE
  145. if test 1117 -ne `wc -c <'htroff'`; then
  146.     echo shar: \"'htroff'\" unpacked with wrong size!
  147. fi
  148. chmod +x 'htroff'
  149. # end of 'htroff'
  150. fi
  151. echo shar: End of shell archive.
  152. exit 0
  153.